package com.meilingcloud.research.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 随访列表对象 rws_follow
 *
 * @author chenl
 * @date 2021-04-21
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("rws_follow")
public class RwsFollow implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 随访ID
     */
    @TableId(value = "follow_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long followId;

    /**
     * 样本源ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "样本源不能为空")
    private Long sourceId;

    /**
     * 计划随访时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date followPlan;

    /**
     * 实际随访时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date followFact;

    /**
     * 随访次数
     */
    private Integer followNum;

    /**
     * 参与随访人员
     */
    private String followVisitor;

    /**
     * 随访状态
     */
    @NotBlank(message = "随访状态不能为空")
    private String followState;

    /**
     * 随访描述
     */
    private String followDesc;

    /**
     * 随访方式
     */
    @NotBlank(message = "随访方式不能为空")
    private String followWay;

    /**
     * 表单key
     */
    private String formKey;

    /**
     * 表单值
     */
    private String formData;

    /**
     * 表单属性定义
     */
    private String formDesc;

    /**
     * 删除标志
     */
    @TableLogic(value = "0", delval = "1")
    private String delFlag;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新者
     */
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    /**
     * 计划采样时间范围
     */
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private List<Date> followPlanRange;

    /**
     * 样本源编号
     */
    @TableField(exist = false)
    private String sourceCode;

    /**
     * 样本源名称
     */
    @TableField(exist = false)
    private String sourceName;

    /**
     * 样本源类型名称
     */
    @TableField(exist = false)
    private String sourceTypeName;

    /**
     * 随访模板ID
     */
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long followTempId;

    /**
     * 间隔时间
     */
    @TableField(exist = false)
    private Integer intervalTime;

    /**
     * 间隔时间单位
     */
    @TableField(exist = false)
    private String intervalUnit;

    /**
     * 随访次数
     */
    @TableField(exist = false)
    private Integer followCount;

    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();
}
